package main

import (
	"fmt"
	"iris_product/common"
	"iris_product/rabbitmq"
	"iris_product/repositories"
	"iris_product/services"
)

func main() {
	db, err := common.NewMysqlConn()
	if err != nil {
		fmt.Println(err)
	}

	// 创建product数据库操作实例
	product := repositories.NewProductManager("product", db)
	// 创建product service
	productService := services.NewProductService(product)
	// 创建Order数据库实例
	order := repositories.NewOrderMangerRepository("order", db)
	// 创建order service
	orderService := services.NewOrderService(order)

	rabbitMQConsumeSimple := rabbitmq.NewRabbitMQSimple("xucooler")
	rabbitMQConsumeSimple.ConsumeSimple(orderService,productService)
}
